﻿using System;
using System.Security.Cryptography;
using System.Text;

namespace EvoGame.Core.Helpers
{
	public static partial class Helper
	{
		public static string HashString(string Value)
		{
			MD5CryptoServiceProvider x = new MD5CryptoServiceProvider();
			byte[] data = Encoding.ASCII.GetBytes(Value);
			data = x.ComputeHash(data);
			string ret = "";
			for (int i = 0; i < data.Length; i++)
				ret += data[i].ToString("x2").ToLower();
			return ret;
		}

		[Serializable, Obsolete]
		public class Vector<T>
		{
			public T X { get { return _x; } }
			public T Y { get { return _y; } }
			public T Z { get { return _z; } }
			public T W { get { return _w; } }

			private T _x, _y, _z, _w;

			public Vector(T x, T y)
			{
				_x = x;
				_y = y;
				_z = default(T);
				_w = default(T);
			}
			public Vector(T x, T y, T z)
			{
				_x = x;
				_y = y;
				_z = z;
				_w = default(T);
			}
			public Vector(T x, T y, T z, T w)
			{
				_x = x;
				_y = y;
				_z = z;
				_w = w;
			}
		}

		public static bool Is64bit()
		{
			return "x86" != Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE", EnvironmentVariableTarget.Machine);
		}
	}
}